package com.supreme.uploadserver.config;

import com.supreme.uploadserver.component.props.MinioProps;
import io.minio.MinioClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

@Configuration
public class MinioConfig {

    @Resource
    private MinioProps minioProps;

    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(minioProps.getHost(), minioProps.getPort(), minioProps.getSecure())
                .credentials(minioProps.getAccessKey(), minioProps.getSecretKey())
                .build();
    }
}
